#!/bin/sh /etc/rc.common
#
# Copyright (C) 2011 OpenWrt.org
#

START=11
STOP=11

USE_PROCD=1
NAME=om-watchdog
PROG=/sbin/om-watchdog

get_gpio() {
	local board=$(board_name)

	if [ "$board" = "teltonika,rut5xx" ]; then
		# ramips
		return 11
	else
		#we assume it is om1p in this case
		return 3
	fi

	return 255
}

start_service() {
	get_gpio
	gpio="$?"
	[ "$gpio" != "255" ] || return

	procd_open_instance
	procd_set_param command "${PROG}" "${gpio}"
	procd_set_param respawn
	procd_close_instance
}
